import { reqSearchInfo } from '@/api';

export default {
    actions: {
        async getSearchList({ commit }, params = {}) {
            let result = await reqSearchInfo(params);
            if (result.code === 200) {
                commit('GETSEARCHLIST', result.data);
            }
        }
    },
    mutations: {
        GETSEARCHLIST(state, searchList) {
            state.searchList = searchList;
        }
    },
    state: {
        searchList: {},
    },
    getters: {
        goodsList({ searchList: { goodsList } }) {
            return goodsList || {};
        },
        attrsList({ searchList: { attrsList } }) {
            return attrsList || {};
        },
        trademarkList({ searchList: { trademarkList } }) {
            return trademarkList || {};
        },
        total({ searchList: { total } }) {
            return total || {};
        }
    }
}